import request from "@/utils/request";
export function register(data:object)//用户注册
{
    return request({
        url:'/users/register',
        method: 'post',
        data
    })
}
export function login(data:object)//用户登录
{
    return request(
        {
            url:'/users/login',
            method:'post',
            data
        }
    )
}
export function getUserInfo(userId: number | string) // 获取用户信息
{
    return request({
        url: `/users/${userId}`,
        method: 'get'
    })
}

export function modifyUserInfo(userId: number | string, userInfo: object) // 修改用户信息
{
    return request({
        url: `/users/${userId}`,
        method: 'put',
        data: userInfo
    })
}

export function addAddress(addressInfo: object) // 添加收货地址
{
    return request({
        url: '/users/addresses',
        method: 'post',
        data: addressInfo
    })
}

export function getAddressList(userId: number | string) // 获取收货地址列表
{
    return request({
        url: `/users/${userId}/addresses`,
        method: 'get'
    })
}